Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Teleport and getting stuck problem

  1. #1

    Default Teleport and getting stuck problem

    Hi all,

    We all know the problem when someone uses a teleport and doesn't move from
    the destination the next guy that comes through gets stuck.

    I tried (emphasis on 'tried', lol) to be creative with the "+forward" command but can't get it to work.
    It doesn't work at all or the guy using the teleport keeps walking forward forever.
    My idea is to automatically make the player move forward one or two steps after
    using the teleport. Or move randomly, might even work better (ie. moving forward or left or right) thus
    keeping the tele destination clear for the next player that uses the teleport.

    I know there are other ways like putting the exit higher in the air, or a script that prevents
    teleporting when the destination is occupied but using the +forward seems like a good idea in my mind.

    This is an example of how my teleport scripts look now: (Stalingrad, MG42 to boilerroom)

    Code:
    port3:
    local.fx = spawn script_model
    local.fx model "fx/corona_red.tik" 
    local.fx.origin = ( 250 -310 230.13 )
    local.fx.scale = 1.5
    local.fx notsolid
    
    
    local.trig = spawn trigger_use origin local.fx.origin
    local.trig setsize ( -10 -10 0 ) ( 10 10 70 )
    while(1)
    {
    local.trig waittill trigger
    local.player = parm.other
    local.player tele ( 903 -302 -151.88 )
    local.player face ( 0 90 0 )
    local.fx hide
    wait 2
    local.fx show
    }
    end
    Maybe one of you coding-animals can help me out. Would be great!

    Cheers,
    Midnight1138

  2. #2
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Here :P

    Try this
    Code:
    port3:
    local.fx = spawn script_model
    local.fx model "fx/corona_red.tik" 
    local.fx.origin = ( 250 -310 230.13 )
    local.fx.scale = 1.5
    local.fx notsolid
    
    
    local.trig = spawn trigger_use origin local.fx.origin
    local.trig setsize ( -10 -10 0 ) ( 10 10 70 )
    while(1)
    {
    local.trig waittill trigger
    local.trig nottriggerable // turns trigger off so theres abit of a break between uses
    local.player = parm.other
    local.player tele ( 903 -302 -151.88 )
    local.player face ( 0 90 0 )
    local.player thread move_player
    local.fx hide
    wait 2
    local.trig triggerable /// turns trigger back on
    local.fx show
    }
    end
    AND
    Code:
    move_player:
    
    local.player = self
    
    local.num = randomint(7)
    
    
    if(local.player == NULL)
    end
    
    if(local.num == 0){
    local.player stufftext "+moveleft"
    wait 0.5
    local.player stufftext "-moveleft"
    }
    
    if(local.num == 1){
    local.player stufftext "+forward;+moveright"
    wait 0.5
    local.player stufftext "-forward;-moveright"
    }
    
    if(local.num == 2){
    local.player stufftext "+forward;+moveleft"
    wait 0.5
    local.player stufftext "-forward;-moveleft"
    }
    
    if(local.num == 3){
    local.player stufftext "+back;+moveright"
    wait 0.5
    local.player stufftext "-back;-moveright"
    }
    
    if(local.num == 4){
    local.player stufftext "+back;+moveleft"
    wait 0.5
    local.player stufftext "-back;-moveleft"
    }
    
    if(local.num == 5){
    local.player stufftext "+back"
    wait 0.5
    local.player stufftext "-back"
    }
    
    if(local.num == 6){
    local.player stufftext "+forward"
    wait 0.5
    local.player stufftext "-forward"
    }
    
    if(local.num == 7){
    local.player stufftext "+moveright"
    wait 0.5
    local.player stufftext "-moveright"
    }
    
    
    end
    You can reuse the move_player thread for the rest of the teleports,
    What it does is randomly moves the player in a direction,
    like forward , back , forward + right , back + left, etc

    What you were missing when you tried it was the
    -forward there

    You need to add
    -forward
    after you use
    +forward
    on a player, after a certain amount of time.
    You can change the wait, time in there, it just tells the player for how long to move for.
    Last edited by Purple Elephant1au; September 13th, 2013 at 06:59 AM.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  3. #3
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    "+forward" just sets the forward flag, so the player will keep moving forward as long as it is set. To stop it, use "-forward".

    Perhaps the player should move in the direction that he can move to because the player could be facing a wall when teleported.
    Something like:
    Code:
    MoveAway:
        local.origin = (self gettagposition "eyes bone");
        local.rad = 96;
        
        if ( (sighttrace local.origin (local.origin + (self.forwardvector * local.rad))) ) {
            local.move = "forward";
        }
        else if ( (sighttrace local.origin (local.origin + ((self.forwardvector * -1) * local.rad))) ) {
            local.move = "back";
        }
        else if ( (sighttrace local.origin (local.origin + (self.leftvector * local.rad))) ) {
            local.move = "moveleft";
        }
        else if ( (sighttrace local.origin (local.origin + (self.rightvector * local.rad))) ) {
            local.move = "moveright";
        }
    
    
        self stufftext ("+"+local.move);
        wait (randomfloat(0.5) + 0.5); //random [0.5; 1.0] interval to wait;
        self stufftext ("-"+local.move);
    end;
    And call it like:
    Code:
    local.player thread MoveAway;
    after the player has been teleported.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  4. #4
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    his looks better :-P

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  5. #5

    Default

    Got it sorted out.
    Thanks guys for teaching me yet another thing!

    One of these days you guys may make a dev out of me yet, lol!

  6. #6

    Default

    Just for reference, I found a better way by spawning pushtriggers at the teleport destinations.
    The "+forward" works but then the teleported player has to let go of his move forward key momentarily and press it again or else
    it looks like he's moving against an invisible wall.

    This is an example of how I use it now: (Southern France)

    Code:
    port3:
    local.fx = spawn script_model
    local.fx model "fx/corona_red.tik" 
    local.fx.origin = ( 689 354 51 )
    local.fx.scale = 1.5
    local.fx notsolid
    
    
    local.trig = spawn trigger_use origin local.fx.origin
    local.trig setsize ( -10 -10 0 ) ( 10 10 70 )
    while(1)
    {
    local.trig waittill trigger
    local.player = parm.other
    local.player tele ( -411 450 926.97 )
    local.player thread push_player3
    local.fx hide
    wait 2
    local.fx show
    }
    wait 1
    end
    push_player3:
    local.trigger = spawn trigger_push origin ( -411 450 926.97 ) "target" "roof"
    spawn script_origin "targetname" "roof" origin ( -411 600 926.97 )
    local.trigger speed 250
    wait 1
    local.trigger remove
    end

  7. #7

    Default

    hey guys

    what would it be for me when i want to push after the teleport?.

    Code:
    teleporter: // secret room
    
    local.ent = spawn script_model targetname ent
    local.ent model "fx/corona_red.tik"
    local.ent.origin = ( -1773.62 -2090.55 534.31 )
    local.ent scale 3
    
    local.teletrig = spawn trigger_multiple targetname tele_trig
    local.teletrig.origin = ( -1773.62 -2090.55 534.31 )
    local.teletrig setsize ( -30 -30 0 ) ( 30 30 50 )
    local.teletrig setthread teleport_player
    
    end
    
    teleport_player:
    
    local.player = parm.other
    $tele_trig nottriggerable
    $tele_trig hide
    $ent2 hide
    
    local.player tele ( -1895.47 -1877.34 481.77 )
    local.player iprint ("You climbed the wall!")
    
    wait 2
    
    $tele_trig show
    $tele_trig triggerable
    
    end
    can u help me out?
    oke i did it

    Code:
    teleporter: // secret room
    
    local.ent = spawn script_model targetname ent
    local.ent model "fx/corona_red.tik"
    local.ent.origin = ( -1773.62 -2090.55 534.31 )
    local.ent scale 3
    
    local.teletrig = spawn trigger_multiple targetname tele_trig
    local.teletrig.origin = ( -1773.62 -2090.55 534.31 )
    local.teletrig setsize ( -30 -30 0 ) ( 30 30 50 )
    local.teletrig setthread teleport_player
    
    end
    
    teleport_player:
    
    local.player = parm.other
    $tele_trig nottriggerable
    $tele_trig hide
    $ent2 hide
    
    local.player tele ( -1895.47 -1877.34 481.77 )
    local.player iprint ("You climbed the wall!")
    
    push_player3:
    local.trigger = spawn trigger_push origin ( -1895.47 -1877.34 481.77 ) "target" "roof"
    spawn script_origin "targetname" "roof" origin ( -1918.85 -1967.10 481.77 )
    wait 1
    local.trigger remove
    
    wait 2
    
    $tele_trig show
    $tele_trig triggerable
    
    end
    it only prints the You climbed the wall twice... but thats oke
    Last edited by Slimbips {sfx}; February 15th, 2014 at 04:29 AM.

  8. #8

    Default

    if i use 2 of this teleports or more.... how do i add 1 extra on midnight his script?... if i add 1 extra and go into the teleport i get shot in the air ...help!

  9. #9

    Default

    took me 6 hours to find out how lol

    Code:
    //  DESTROYED VILLAGE 
    
    port1:
    local.fx = spawn script_model
    local.fx model "fx/corona_red.tik" 
    local.fx.origin = ( -1003 -985 90 )
    local.fx.scale = 1.5
    local.fx notsolid
    //local.fx hide
    
    
    local.trig = spawn trigger_use origin local.fx.origin
    local.trig setsize ( -20 -20 -20 ) ( 20 20 20 )
    while(1)
    {
    local.trig waittill trigger
    local.player = parm.other
    local.player tele ( -1010 -965 328 )
    local.player thread push_player3
    local.fx hide
    wait 2
    local.fx show
    }
    wait 1
    end
    push_player3:
    local.trigger = spawn trigger_push origin ( -1010 -965 328 ) "target" "roof"
    spawn script_origin "targetname" "roof" origin ( -1010 -945 328 )
    local.trigger speed 250
    wait 1
    local.trigger remove
    end
    
    //--------------------------------------------------------------------------
    //  DESTROYED VILLAGE 
    
    port2:
    local.fx = spawn script_model
    local.fx model "fx/corona_red.tik" 
    local.fx.origin = ( 366 -1180 13 )
    local.fx.scale = 1.5
    local.fx notsolid
    //local.fx hide
    
    
    local.trig2 = spawn trigger_use origin local.fx.origin
    local.trig2 setsize ( -20 -20 -20 ) ( 20 20 20 )
    while(1)
    {
    local.trig2 waittill trigger
    local.player2 = parm.other
    local.player2 tele ( 362 -1182 214 )
    local.player2 thread push_player3
    local.fx hide
    wait 2
    local.fx show
    }
    wait 1
    end
    push_player3:
    local.trigger2 = spawn trigger_push origin ( 362 -1182 214 ) "target" "roof2"
    spawn script_origin "targetname" "roof2" origin ( 323 -1163 214 )
    local.trigger2 speed 250
    wait 1
    local.trigger2 remove
    end
    
    
    //----------------------------------------------------------------------------

  10. #10

    Default

    I've been thinking about making the player that teleports notsolid for 0.5 seconds.
    That would be a good solution if the teleport exit is not near solid structures so they can't get stuck in something solid, like
    a wall or furniture.

    In the examples above I tried "local.player notsolid" or "local.player ghost" but that doesn't work. Would have been nice but alas..
    Maybe something can be done with the noclip command, but that would require cheats to be set to ON..

    Perhaps something could be scripted for that, but i'm not that familiar with all available (reborn) scripting commands.
    Is there anyone out there that can think of a way?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •